# 定义Animal类
class Animal:
    def __init__(self, name):
        self.name = name

    def speak(self):
        print(f"The {self.__class__.__name__.lower()} makes a sound.")


# 继承Animal
class Dog(Animal):
    def __init__(self, name, breed):
        super().__init__(name)
        # dog自己的属性breed
        self.breed = breed

    def speak(self):
        print("Woof!")


# 继承Animal
class Cat(Animal):
    def __init__(self, name, color):
        super().__init__(name)
        # Cat自己的属性color
        self.color = color

    def speak(self):
        print("Meow!")


# 调用类
dog = Dog("小包", "泰迪")
# 输出: Woof!
dog.speak()
print(f"小狗的名字是{dog.name}，品种是{dog.breed}")
cat = Cat("小孔", "黄色")
# 输出: Meow!
cat.speak()
print(f"小猫的名字是{cat.name}，颜色是{cat.color}")
